import Vue from 'vue'
import Router from 'vue-router'
import Home from '@/views/pages/Home.vue'
import Layout from '@/views/layout/default.vue'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      redirect: '/home'
    },
    {
      path: '/signin',
      name: 'SignIn',
      component: () => import('@/views/pages/SignIn.vue'),
      meta: { verifyToken: false, title: '登录页面' }
    },
    {
      path: '/signup',
      name: 'SignUp',
      component: () => import('@/views/pages/SignUp.vue'),
      meta: { verifyToken: false, title: '注册页面' }
    },
    {
      path: '/home',
      name: 'Home',
      component: Layout,
      children: [
        {
          path: '/',
          name: 'home',
          component: Home,
          meta: { verifyToken: false, title: '首页' }
        },
        {
          path: 'test',
          name: 'HomeTest',
          component: Home,
          meta: { verifyToken: true, title: '测试页面' }
        }
      ]
    },
    {
      path: '*',
      name: 'error',
      component: () => import('@/views/error/Index.vue'),
      meta: { verifyToken: false, title: '页面错误' }
    }
  ]
})
